<?php

include ("PHPFunctions/function_register.php");


$matricula = $_POST["Usuario"];
$password = sha1($_POST["Password"]);

$conn = db_connect();
	if(!$conn){
		die('Could not connect: ' . mysql_error());
	}
	mysql_select_db("josel_Asesorias", $conn);
	
	$result = mysql_query("Select * from Alumnos where Matricula = '$matricula' AND Password = '$password'");
	if (mysql_num_rows($result) != 0){
		$citas = mysql_query("Select * from Dias where Alumno = '$matricula'");
		if (mysql_num_rows($citas) != 0){
			echo "Tienes registradas las siguientes citas:\n\n";
			echo "   Fecha          Hora          Lugar\n";
			echo "---------------------------------------------------\n";
			while($row = mysql_fetch_array($citas)){
				echo $row[1]."      ".$row[2]."        ".$row[4]."\n";
			}
		}else{
			echo "No tienes asesorias reistradas";
		}
	}else{
		echo "Usuario y/o Password incorrecto";
	}
